home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / KEYBOARD.SWG / 0085_Stuffing Keyboard.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-25  |  2KB  |  81 lines

  1. {
  2. > How do I stuff a string into the keyboard buffer?
  3.  
  4. I've got two things for you:
  5.  
  6. 1:  Turbo Power's Object Professional's OpCRT unit has the following
  7. useful routines:
  8. procedure StuffKey(W : Word);
  9.   {-Stuff one key into the keyboard buffer}
  10.  
  11. procedure StuffString(S : string);
  12.   {-Stuff the contents of S into the keyboard buffer}
  13.  
  14. {
  15. 2: If you don't have Object Professional (it's $895.00 but worth it)
  16. Before I noticed that OpCRT would do what I needed, I sat down and
  17. wrote the following code.  It's rough, but gives a pretty good idea
  18. of how the keyboard buffer works, and there's a chance that you can
  19. use it to create your own Stuffer
  20. }
  21. program ViewKbdBufr;
  22.  
  23. (********************************************************************
  24. ***
  25.    Written By Kevin R. Pierce - June 25, 1994
  26. *********************************************************************
  27. **)
  28.  
  29. Uses
  30.   OpString,  {This is where HexB is.  You can write your own easy
  31. enough}
  32.   CRT;
  33.  
  34. var
  35.   Buffer_Head : Byte absolute $0040:$001A;
  36.   Buffer_Tail : Byte absolute $0040:$001C;
  37.   Buffer_Start: Byte absolute $0040:$0080;
  38.   Buffer_End  : Byte absolute $0040:$0082;
  39.  
  40.   var
  41.     t : byte;
  42.  
  43. begin
  44.   clrscr;
  45.   repeat
  46.     gotoxy(1,1);
  47.     writeln('Buffer Head  = ',HexB(Buffer_Head));
  48.     writeln('Buffer Tail  = ',HexB(Buffer_Tail));
  49.     writeln('Buffer Start = ',HexB(Buffer_Start));
  50.     writeln('Buffer End   = ',HexB(Buffer_End));
  51.     writeln;
  52.     if Buffer_Tail >Buffer_Head then {simple list}
  53.       begin
  54.         for t:=Buffer_Head to Buffer_Tail do
  55.           write(Byte(Ptr(Seg0040,t)^):4);
  56.       end
  57.      else  {loop back to START}
  58.       if Buffer_Head<>Buffer_Tail then
  59.         begin
  60.           for t:=Buffer_Head to Buffer_End do
  61.             write(Byte(Ptr(Seg0040,t)^):4);
  62.           for t:=Buffer_Start to Buffer_Tail do
  63.             write(Byte(Ptr(Seg0040,t)^):4);
  64.         end;
  65.     clreol;
  66.     writeln;
  67.     writeln(Byte(Ptr(Seg0040,Buffer_Head)^):3);
  68.     writeln(Byte(Ptr(Seg0040,Buffer_Tail)^):3);
  69.     writeln(Byte(Ptr(Seg0040,Buffer_Start)^):3);
  70.     writeln(Byte(Ptr(Seg0040,Buffer_End)^):3);
  71.  
  72.     writeln;
  73.     for t:=ofs(Buffer_Head) to ofs(Buffer_Tail) do
  74.       write(Byte(Ptr(seg(Buffer_Head),t)^):3);
  75.  
  76.   until FALSE;
  77. {endless Loop - Use Ctrl-Break to stop (you might have to reboot if
  78. you run BP under Windows.}
  79.  
  80. end.
  81.